import java.io.IOException;
import java.text.ParseException;
import java.util.Date;

import jxl.read.biff.BiffException;


public class ARXWeekDays extends NoaaDataWeekDays{
	private double[][] ARXmodel;
	
	

	public ARXWeekDays(int datasize){
		super();
		this.ARXmodel = new double[datasize][26];
	}
	
	
	
	
	
	/**
	 * @return the aRXmodel
	 */
	public double[][] getARXmodel() {
		return ARXmodel;
	}

	/**
	 * @param aRXmodel the aRXmodel to set
	 * @throws ParseException 
	 * @throws IOException 
	 * @throws BiffException 
	 */
	public void setARXmodel() throws ParseException, BiffException, IOException {
		int dataSize = super.getNoaaData().getDataSize();
		
//		for(int i = 24; i < dataSize - 1; i++)
			for(int i = 72; i < 80; i++){
				String localTime = super.getNoaaData().getLocalTime_array()[i].getContents();
				Date date = Utility.convertToDate(localTime);
				
				//Constant
				ARXmodel[i][0] = 1d;
				
				//T_Max_t
				ARXmodel[i][1] = super.getNoaaData().getT_MAX_t().get(date);
				
				//T_Min_t
				ARXmodel[i][2] = super.getNoaaData().getT_MIN_t().get(date);
				
				//T_t
				ARXmodel[i][3] = super.getNoaaData().getT_t().get(date);
				
				//T_t * T_t
				ARXmodel[i][4] = ARXmodel[i][3] * ARXmodel[i][3];
				
				//RH_t
				ARXmodel[i][5] = super.getNoaaData().getRH_t().get(date);
				
				//RH_t * T_t
				ARXmodel[i][6] = ARXmodel[i][5] * ARXmodel[i][3];
				
				
				//Cool load t-1
				ARXmodel[i][7] = super.getLastNHour(localTime, 1).getCoolLoadt();
				
				//T_t-1
				ARXmodel[i][8] = super.getLastNHour(localTime, 1).getTt();
				
				//T_t-1 * T_t-1
				ARXmodel[i][9] = ARXmodel[i][8]*ARXmodel[i][8];
				
				//RH_t-1
				ARXmodel[i][10] = super.getLastNHour(localTime, 1).getRHt();
				
				//T_t-1 * RH_t-1
				ARXmodel[i][11] = ARXmodel[i][8]*ARXmodel[i][10];
				
				//Cool load t-2
				ARXmodel[i][12] = super.getLastNHour(localTime, 2).getCoolLoadt();
				
				//T_t-2
				ARXmodel[i][13] = super.getLastNHour(localTime, 2).getTt();
				
				//T_t-2 * T_t-2
				ARXmodel[i][14] = ARXmodel[i][13]*ARXmodel[i][13];
				
				//RH_t-2
				ARXmodel[i][15] = super.getLastNHour(localTime, 2).getRHt();
				
				//T_t-2 * RH_t-2
				ARXmodel[i][16] = ARXmodel[i][13]*ARXmodel[i][15];
				
				//Cool load t-24
				ARXmodel[i][17] = super.getLastNHour(localTime, 24).getCoolLoadt();
				
				//T_t-24
				ARXmodel[i][18] = super.getLastNHour(localTime, 24).getTt();
				
				//T_t-24 * T_t-24
				ARXmodel[i][19] = ARXmodel[i][18]*ARXmodel[i][18];
				
				//RH_t-24
				ARXmodel[i][20] = super.getLastNHour(localTime, 24).getRHt();
				
				//T_t-24 * RH_t-24
				ARXmodel[i][21] = ARXmodel[i][18]*ARXmodel[i][20];
				
				//T_t * T_t-1
				ARXmodel[i][22] = ARXmodel[i][3]*ARXmodel[i][8];
				
				//RH_t * RH_t-1
				ARXmodel[i][23] = ARXmodel[i][5]*ARXmodel[i][8];
				
				//T_t * T_t-2
				ARXmodel[i][24] = ARXmodel[i][3]*ARXmodel[i][13];
				
				//RH_t * RH_t-2
				ARXmodel[i][25] = ARXmodel[i][5]*ARXmodel[i][15];
				
		}
	}
}
